/*
 * AbstractValueEditor.java - Copyright Apr 27, 2012 Z Networks Group, Inc. All rights reserved.
 * Z Networks Group PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
 */
package com.andromeda.skadi.sandbox2;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

/**
 *
 * @author Dickinson Roman Arismendy Torres
 */
public abstract class AbstractValueEditor<T extends Serializable> implements ValueEditor<T> {

    private List<ValueChangeListener<T>> listeners = new ArrayList<ValueChangeListener<T>>();

    @Override
    public void addValueChangeListener(ValueChangeListener<T> listener) {
        listeners.add(listener);
    }

    @Override
    public void removeChangeListener(ValueChangeListener<T> listener) {
        listeners.remove(listener);
    }

    protected void fireValueChanged() {
        for (ValueChangeListener<T> listener : listeners) {
            listener.valueChanged();
        }
    }
}
